/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Carito
 */
@Entity
@Table(name = "DATO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Dato.findAll", query = "SELECT d FROM Dato d"),
    @NamedQuery(name = "Dato.findByIddato", query = "SELECT d FROM Dato d WHERE d.iddato = :iddato"),
    @NamedQuery(name = "Dato.findByDescripcion", query = "SELECT d FROM Dato d WHERE d.descripcion = :descripcion")})
public class Dato implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "IDDATO")
    private BigInteger iddato;
    @Size(max = 150)
    @Column(name = "DESCRIPCION")
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "dato", fetch = FetchType.EAGER)
    private List<Inddeuda> inddeudaList;
    @OneToMany(mappedBy = "iddato", fetch = FetchType.EAGER)
    private List<Preferencia> preferenciaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "dato", fetch = FetchType.EAGER)
    private List<Formato> formatoList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "dato", fetch = FetchType.EAGER)
    private List<Trm> trmList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "dato", fetch = FetchType.EAGER)
    private List<Boletin> boletinList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "dato", fetch = FetchType.EAGER)
    private List<Video> videoList;
    @JoinColumn(name = "IDPERMISO", referencedColumnName = "IDPERMISO")
    @OneToOne(fetch = FetchType.EAGER)
    private Permiso idpermiso;

    public Dato() {
    }

    public Dato(BigInteger iddato) {
        this.iddato = iddato;
    }

    @XmlAttribute
    public BigInteger getIddato() {
        return iddato;
    }

    public void setIddato(BigInteger iddato) {
        this.iddato = iddato;
    }

    @XmlElement
    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    @XmlTransient
    public List<Inddeuda> getInddeudaList() {
        return inddeudaList;
    }

    public void setInddeudaList(List<Inddeuda> inddeudaList) {
        this.inddeudaList = inddeudaList;
    }

    @XmlTransient
    public List<Preferencia> getPreferenciaList() {
        return preferenciaList;
    }

    public void setPreferenciaList(List<Preferencia> preferenciaList) {
        this.preferenciaList = preferenciaList;
    }

    @XmlTransient
    public List<Formato> getFormatoList() {
        return formatoList;
    }

    public void setFormatoList(List<Formato> formatoList) {
        this.formatoList = formatoList;
    }

    @XmlTransient
    public List<Trm> getTrmList() {
        return trmList;
    }

    public void setTrmList(List<Trm> trmList) {
        this.trmList = trmList;
    }

    @XmlTransient
    public List<Boletin> getBoletinList() {
        return boletinList;
    }

    public void setBoletinList(List<Boletin> boletinList) {
        this.boletinList = boletinList;
    }

    @XmlTransient
    public List<Video> getVideoList() {
        return videoList;
    }

    public void setVideoList(List<Video> videoList) {
        this.videoList = videoList;
    }

    @XmlElement
    public Permiso getIdpermiso() {
        return idpermiso;
    }

    public void setIdpermiso(Permiso idpermiso) {
        this.idpermiso = idpermiso;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iddato != null ? iddato.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Dato)) {
            return false;
        }
        Dato other = (Dato) object;
        if ((this.iddato == null && other.iddato != null) || (this.iddato != null && !this.iddato.equals(other.iddato))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Dato[ iddato=" + iddato + " ]";
    }
    
}
